<template>
  <div class="bottom-nav bottom_nav" v-show="bar">
    <div class="item menu-button" id="menu_button" @click="showListPanel">
      <div class="item-warp">
        <div class="icon-menu"></div>
        <div class="icon-text">
          目录
        </div>
      </div>
    </div>
    <div class="item" :class="{'current': font_icon_class}" id="font-button" @click="showFontPanel">
      <div class="item-warp">
        <div class="icon-ft"></div>
        <div class="icon-text">
          字体
        </div>
      </div>
    </div>
    <div class="item" id="night-button" @click="swithNight">
      <div class="item-warp" style="display:none" >
        <div class="icon-day"></div>
        <div class="icon-text">
          白天
        </div>
      </div>
      <div class="item-warp">
        <div class="icon-night"></div>
        <div class="icon-text">
          夜间
        </div>
      </div>
    </div>
  </div>
</template>
<script type="text/ecmascript-6">
  import {mapState} from 'vuex'

  export default {
    data() {
      return {
        font_icon_class: false
      }
    },
    methods: {
      showListPanel() {
          this.$store.dispatch('showListPanel')
        this.$store.state.font_panel = false
      },
      showFontPanel() {
        this.font_icon_class = !this.font_icon_class
        this.$store.dispatch('showFontPanel')
      },
      swithNight() {
        this.$store.dispatch('switchNight')
      }
    },
    computed: {
      ...mapState([
        'font_panel','list_panel','bar'/*,'font_icon'*/
      ]),
    },
  }
</script>
<style lang="less" type="text/less">
  .bottom-nav {
    position: fixed;
    bottom: 0px;
    height: 70px;
    background: #000000;
    width: 100%;
    opacity: 1;
    z-index: 9;
    margin: 0 auto;
    text-align: center;
    .item {
      display: inline-block;
      width: 32%;
      color: #fff;
      text-align: center;
      margin: 0 auto;
      .item-warp {
        width: 26px;
        margin: 0 auto;
        position: relative;
      }
    }
  }

  .icon-text {
    position: absolute;
    top: 25px;
    font-size: 10px;
  }

  .icon-menu,
  .icon-ft,
  .icon-night,
  .icon-day {
    position: absolute;
    top: 3px;
    left: 2px;
    width: 18px;
    height: 13px;
    background: url();
    background-size: contain;
  }

  .icon-night,
  .icon-day,
  .icon-ft {
    left: 1px;
  }

  .icon-ft {
    width: 20px;
    height: 13px;
    background: url();
    background-size: contain;
  }

  .current .icon-ft {
    top: 2px;
    left: 0px;
    width: 22px;
    height: 15px;
    background: url();
    background-size: contain;
  }

  .icon-day {
    width: 19px;
    height: 18px;
    background: url();
    background-size: contain;
  }

  .icon-night {
    left: 4px;
    width: 16px;
    height: 16px;
    background: url();
    background-size: contain;
  }

</style>
